import Vue from "vue";
import VueRouter from "vue-router";
// 展示不考虑路由懒加载（防止后面有路由对应的组件需要获取路由信息获取不到）
import FilmsIndex from "@/views/Films/Index";
import NowPlaying from "@/views/Films/NowPlaying";
import ComingSoon from "@/views/Films/ComingSoon";
import CinemasIndex from "@/views/Cinemas/Index";
import NewsIndex from "@/views/News/Index";
import CeneterIndex from "@/views/Center/Index";
import Login from "@/views/Center/Login";

Vue.use(VueRouter);

const routes = [
    // 重定向，访问“/” → “/films/nowPlaying”
    {
        path: "/",
        redirect: "/films/nowPlaying",
    },

    // 电影模块
    {
        path: "/films",
        component: FilmsIndex,
        children: [
            { path: "nowPlaying", component: NowPlaying },
            { path: "comingSoon", component: ComingSoon },
        ],
    },

    // 影院模块
    {
        path: "/cinemas",
        component: CinemasIndex,
    },

    // 资讯模块
    {
        path: "/infomations",
        component: NewsIndex,
    },

    // 我的模块
    {
        path: "/center",
        component: CeneterIndex,
    },
    {
        path: "/login",
        component: Login,
    },

    // ....
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;
